package com.github.common.extend.demo.config.validator;

import com.github.common.extend.demo.config.BaseEnum;
import com.github.common.extend.demo.config.VerifyEnum;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @author wangjj7
 * @date 2024/4/22
 * @description
 */
@Documented
@Constraint(validatedBy = {EnumOfListValidator.class})
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
@Retention(RUNTIME)
public @interface EnumOfList {

    String message() default "{validator.constraints.NotEnumCode.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    boolean allowEmpty() default true;

    /**
     * 实现{@link BaseEnum}的枚举类型
     * @return
     */
    Class<? extends VerifyEnum> enums();

    /**
     * Defines several {@code @Email} annotations on the same element.
     */
    @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER })
    @Retention(RUNTIME)
    @Documented
    @interface List {
        EnumOfList[] value();
    }

}
